﻿Public Class clsJpCheck

    Public Function insert(en As entityJPCheck) As Integer
        Dim sql As String = String.Empty
        Dim rtn As Integer
        sql &= "INSERT INTO sf.b_yf_jp_check( factory_id , date_jp , date_check , jl_type , jp_type , project_name , "
        sql &= "lh_t10 , lh_t90 , lh_ml , lh_mh , lx_yd , lx_ls , lx_dl , "
        sql &= "lx_ds25 , lx_ds100 , lx_ds300 , lx_ds400 , jp_md , check_result , "
        sql &= "note , oper, update_time) "
        sql &= "VALUES ( ?, ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,(SELECT CURRENT_TIMESTAMP(6)))"
        With en
            rtn = DBacs.ExecuteUpdateSql(sql, -1, .factory_id, .date_jp, .date_check, .jl_type, .jp_type, .project_name,
                                         .lh_t10, .lh_t90, .lh_ml, .lh_mh, .lx_yd, .lx_ls, .lx_dl,
                                         .lx_ds25, .lx_ds100, .lx_ds300, .lx_ds400, .jp_md, .check_result,
                                         .note, .oper)
        End With
        Return rtn
    End Function

    Public Function update(en As entityJPCheck) As Integer
        Dim sql As String = String.Empty
        Dim rtn As Integer
        sql &= " UPDATE sf.b_yf_jp_check SET date_jp = ? , date_check = ? , jl_type = ? , jp_type = ? , project_name = ? "
        sql &= " , lh_t10 = ? , lh_t90 = ?, lh_ml = ?, lh_mh = ?, lx_yd = ?, lx_ls = ?, lx_dl = ? "
        sql &= " , lx_ds25 = ? , lx_ds100 = ?, lx_ds300 = ?, lx_ds400 = ?, jp_md = ?, check_result = ? "
        sql &= " , note = ?, update_time = (SELECT CURRENT_TIMESTAMP(6))"
        sql &= " WHERE sys_id = ? "
        With en
            rtn = DBacs.ExecuteUpdateSql(sql, -1, .date_jp, .date_check, .jl_type, .jp_type, .project_name,
                                         .lh_t10, .lh_t90, .lh_ml, .lh_mh, .lx_yd, .lx_ls, .lx_dl,
                                         .lx_ds25, .lx_ds100, .lx_ds300, .lx_ds400, .jp_md, .check_result,
                                         .note, .sys_id)
        End With
        Return rtn
    End Function

    Public Function selectBySysid(_sysid As String) As DataTable
        Dim szSql As String = "select * from sf.b_yf_jp_check where factory_id=? and sys_id=?"
        Return DBacs.ExecuteSql(szSql, -1, "TS", _sysid)
    End Function

    Public Function getList(startTime As String, endTime As String) As DataTable
        Dim szSql As String = ""
        szSql &= " select * from sf.b_yf_jp_check "
        szSql &= " where 1=1 "
        If startTime <> "" Then
            szSql &= " and update_time >= '" + startTime + "'"
        End If
        If endTime <> "" Then
            szSql &= " and update_time <= '" + endTime + "'"
        End If
        Return DBacs.ExecuteSql(szSql, -1)
    End Function

End Class
